{# SPDX-License-Identifier: Apache-2.0 -#}
{% extends "confirm-action.html" %}
{% block title %}
  {% trans %}Confirm Invite{% endtrans %}
{% endblock %}
{% block prompt %}
  {% if request.user.has_two_factor %}
    {{ super() }}
  {% else %}
    <!-- Content hidden -->
  {% endif %}
{% endblock %}
{% block main %}
  {% if request.user.has_two_factor %}
    <form method="post">
      <div class="form-group">
        <input name="csrf_token"
               type="hidden"
               value="{{ request.session.get_csrf_token() }}">
        <span class="form-group__text">
          {% trans project_name=project_name, role_name=desired_role, project_link=request.route_url('packaging.project', name=project_name) %}
          Would you like to accept this invitation to join '<a href="{{ project_link }}">{{ project_name }}</a>' as a project {{ role_name }}?
        {% endtrans %}
      </span>
    </div>
    <div>
      <input name="accept"
             type="submit"
             value="{% trans %}Accept{% endtrans %}"
             class="button button--primary">
      <input name="decline"
             type="submit"
             value="{% trans %}Decline{% endtrans %}"
             class="button">
    </div>
  </form>
{% else %}
  {# user has not enabled 2FA #}
  {% trans href=request.route_path('manage.account.two-factor') %}
  You must first enable <a href="{{ href }}">two-factor authentication</a> on your account before accepting an invitation to join a project.
{% endtrans %}
{% endif %}
{% endblock %}
